home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / giochi / muiempir.lha / source / empire.c next >
C/C++ Source or Header  |  1995-08-02  |  61KB  |  1,466 lines

  1. #include "defines.h"
  2. #include "guidefines.h"
  3. #include "struct.h"
  4. #include "externalprototypes.h"
  5. #include "MUIEmpire_rev.h"
  6. near long __stack = 20000L;
  7. struct Library *MUIMasterBase;
  8. void fail (APTR,char *);
  9.  
  10. #ifdef _DCC
  11.  
  12. int brkfunc(void) { return(0); }
  13.  
  14. int wbmain(struct WBStartup *wb_startup)
  15. {
  16.         extern int main(int argc, char *argv[]);
  17.         return (main(0, NULL));
  18. }
  19.  
  20. #endif
  21.  
  22.  
  23. #ifdef __SASC
  24. int CXBRK(void) { return(0); }
  25. int _CXBRK(void) { return(0); }
  26. void chkabort(void) {}
  27. #endif
  28.  
  29.  
  30. static VOID init(VOID)
  31. {
  32. #ifdef _DCC
  33.         onbreak(brkfunc);
  34. #endif
  35.  
  36. #ifndef _DCC
  37.         if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  38.                 fail(NULL,"Failed to open "MUIMASTER_NAME".");
  39. #endif
  40.  
  41.  
  42. #ifndef _DCC
  43.         if (!(UtilityBase = OpenLibrary("utility.library",37)))
  44.                 fail(NULL,"Failed to open Utility Library");
  45. #endif
  46. }
  47.  
  48.  
  49. #ifndef __SASC
  50. static VOID stccpy(char *dest,char *source,int len)
  51. {
  52.         strncpy(dest,source,len);
  53.         dest[len-1]='\0';
  54. }
  55. #endif
  56.  
  57.  
  58. #ifndef MAKE_ID
  59. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  60. #endif
  61.  
  62.  
  63.  
  64. #define DEBUG FALSE
  65.  
  66.   
  67. const char  *popitem[] = {
  68.                           "Credits",            
  69.                           "Fuel",
  70.                           "Troops",
  71.                           "Planetary Scanner I",
  72.                           "Machinery", 
  73.                           "Space Mine I", 
  74.                           "Space Mine II",      
  75.                           "Space Mine III",     
  76.                           "Space Mine IV",        
  77.                           "Steel",              
  78.                           "Gold",               
  79.                           "Iron",               
  80.                           "Wool",                        
  81.                           "Grain",              
  82.                           "Uranium",            
  83.                           "Plutonium",          
  84.                           "Textile",            
  85.                           "Rubber",             
  86.                           "Mainframes",         
  87.                           "Spices",
  88.                           "Technology",             
  89.                           "Alcohol",            
  90.                           "Narcotics",          
  91.                           "Refinery",           
  92.                           "HyperGate",          
  93.                           "Plasma Torpedo",      
  94.                           "High Energy Laser",  
  95.                           "Disruptor",          
  96.                           "Torpedo",            
  97.                           "Vaporizer",          
  98.                           "10 Shield Energy",   
  99.                           "50 Shield Energy",   
  100.                           "100 Shield Energy",  
  101.                           "200 Shield Energy",  
  102.                           "400 Shield Energy",  
  103.                           "600 Shield Energy",                                           
  104.                           NULL,};
  105.                           
  106. const char *pages2[] = {"Automatic Navigation","Automatic Trade",NULL,};
  107. const char *pages3[] = {"Planet Information","Fleet Information","Sector Information","Player Information",NULL,};
  108. const char *pages4[] = {"Planet Inventory","Sector Inventory",NULL,};
  109. const char *pages5[] = {"Sector Inventory","Fleet Inventory",NULL,};
  110. const char *contact1[] = {"Patrol Mission","Trade Mission",NULL,};
  111. const char *contact2[] = {"New Orders","Keep Orders","Cycle Orders",NULL,};
  112. char *players[] = { NULL };
  113.  
  114.   
  115.  
  116.  
  117.  
  118. extern struct Image mapimages1;
  119. extern struct Image mapimages2;
  120. extern struct Image mapimages3;
  121. extern struct Image mapimages4;
  122. extern struct Image mapimages5;
  123. extern struct Image mapimages6;
  124. extern LONG GALAXY;
  125. extern int planetnumber;
  126. extern int playernumber;
  127. extern struct player *currentplayer;
  128. extern struct planet **planetlist;
  129. extern struct sector **SECTOR;
  130. extern struct computerplayer *currentcomputerplayer;
  131. extern struct MsgPort *client;
  132.  
  133. APTR tx1,tx2,tx3,tx4,tx5,tx6,tx7,tx8,tx9,tx10,tx11,tx12,tx13,tx14; 
  134. APTR tx15,tx16,tx17,tx18,tx19,tx20,tx21,tx22,tx23,tx24,tx25,tx26,tx27;
  135. APTR tx28,tx29,tx30,tx31,tx32;
  136. APTR lv1,lv2,lv3,lv4,lv5,lv6,pcy1,pgr1,pcy2,pgr2;
  137. APTR lv7,lv8,lv9,lv10,lv11,lv12,lv13,lv14,lv15,lv16,lv17,lv18;
  138. APTR str5,str6,str7,str8,str9,str10,str11,str12;
  139. APTR app,sc1,str1,str2,str3,str4,im1,BT_NextPlanet,BT_LastPlanet,BT_NextPlayer;
  140. APTR BT_Hyper,BT_Movement,BT_ApplyTrade,BT_CancelTrade;
  141. APTR WI_Movement, WI_Purchase, WI_PlanetCargo, WI_Player, WI_Mainwindow;
  142. APTR WI_FleetCargo,WI_ShipDesign;
  143. APTR WI_Map,WI_Configuration,WI_Gauge,ra1,ra2,ck1,ck2;
  144. APTR cy2,sl1,sl2,sl3,sl4,sl5,sl6,sl7,sl8,sl9,sl10,sl11,sl12,sl13;
  145. APTR sl14,sl15,sl16,sl17,sl18,sl19,sl20,sl21,sl22,sl30,sl31,sl32,sl33,sl34;
  146. APTR sl35,sl36,sl37,sl38,sl39,sl40,sl41,sl42,sl43,sl44;
  147. APTR strip,pop1,pop2,gauge1,SuperClass;
  148. APTR Hypergroup;
  149. APTR BT_AutoFuel;
  150. APTR BT_Sellship,BT_Showships;
  151. APTR MyObj,reg1,reg2;
  152. APTR BT_Purchase, BT_Quit,BT_LastPlayer;
  153. APTR BT_FleetCargo,BT_Map,BT_Cancel,BT_PlanetCargo;
  154. APTR BT_Done,BT_LoadGame,BT_AddPlayer,BT_RemovePlayer;
  155. APTR BT_ClearCourse;
  156. APTR BT_NextForce,BT_LastForce,BT_MakePurchase,BT_PlotCourse;
  157. APTR BT_NextFleet,BT_LastFleet;
  158. APTR BT_PurchaseShip,BT_ShipDesign,BT_PurchaseDesign;
  159. APTR BT_SectorTransferFle;
  160. APTR BT_SectorTransferPla;
  161. APTR BT_PlanetTransferSec;
  162. APTR BT_FleetTransferSec;
  163. APTR BT_SellGoods;
  164. APTR BT_SendPartial;
  165. APTR BT_SendMessage;
  166. APTR BT_ClearMessage;
  167. APTR BT_JoinFleet,WI_Login,str13,str14,str15,BT_PlayGame,tx33,tx34,vi1;   
  168. APTR BT_SetProduction,BT_ClearProduction,tx35;
  169. APTR WI_Fleet,WI_Sector,WI_Message;
  170. ULONG memory=0;
  171. struct IClass *MyClass;
  172. extern struct Image mapbackground;
  173.  
  174. /*
  175.  * prototypes
  176.  */
  177. extern int core (void);
  178. extern BOOL insector(int,int,int);
  179. extern int cleanmemory (void);
  180. LONG guiRequest(LONG);
  181. static ULONG MUIM_xxx_CallRedraw(struct IClass *TheClass, Object *TheObject, Msg Message);
  182.  
  183. __saveds __asm struct temp *consfleet(register __a0 struct Hook *hook,
  184.                                       register __a2 APTR mem_pool,
  185.                                       register __a1 struct force *fleet);
  186. __saveds __asm LONG desfleet(register __a0 struct Hook *hook,
  187.                              register __a2 APTR mem_pool,
  188.                              register __a1 struct temp *fleet);
  189. __saveds __asm LONG dispfleet(register __a0 struct Hook *hook,
  190.                              register __a2 char **array,
  191.                              register __a1 struct temp *fleet);
  192.  
  193. __saveds __asm struct tagchar *constag  (register __a0 struct Hook *hook,
  194.                                         register __a2 APTR mem_pool,
  195.                                         register __a1 struct tagchar *tag);
  196. __saveds __asm LONG destag  (register __a0 struct Hook *hook,
  197.                              register __a2 APTR mem_pool,
  198.                              register __a1 struct tagchar *tag);
  199. __saveds __asm LONG disptag (register __a0 struct Hook *hook,
  200.                              register __a2 char **array,
  201.                              register __a1 struct tagchar *tag);
  202. __saveds __asm LONG disppurch (register __a0 struct Hook *hook,
  203.                                register __a2 char **array,
  204.                                register __a1 struct tagchar *tag);
  205. __saveds __asm LONG dispship(register __a0 struct Hook *hook, 
  206.                             register __a2 char **array,
  207.                             register __a1 struct shiptag *ship);
  208. __saveds __asm struct shiptag *consship(register __a0 struct Hook *hook,
  209.                                         register __a2 APTR mem_pool,
  210.                                         register __a1 struct ship *ship);
  211. __saveds __asm LONG desship (register __a0 struct Hook *hook,
  212.                              register __a2 APTR mem_pool,
  213.                              register __a1 struct shiptag *ship);
  214.  
  215.  
  216.  
  217.  
  218. static struct NewMenu MenuData1[] = {
  219.   {NM_TITLE, "Project"        , 0 , 0 , 0      ,(APTR)0},
  220.   {NM_ITEM,  "About"          ,"?", 0 , 0      ,(APTR)ID_ABOUT},
  221.   {NM_ITEM,  NM_BARLABEL      , 0 , 0 , 0      ,(APTR)0},
  222.   {NM_ITEM,  "Save Game"      ,"S", 0 , 0      ,(APTR)MEN_SAVEGAME},
  223.   {NM_ITEM,  "Save Game as.." , 0 , 0 , 0      ,(APTR)MEN_SAVEGAMEAS},
  224.   {NM_ITEM,  NM_BARLABEL      , 0 , 0 , 0      ,(APTR)0},
  225.   {NM_ITEM,  "Quit"           ,"Q", 0 , 0      ,(APTR)ID_QUIT},
  226.   {NM_TITLE, "Windows"        , 0 , 0 , 0      ,(APTR)0},
  227.   {NM_ITEM,  "Fleet Window"   , 0 , 0 , 0      ,(APTR)ID_FLEETWINDOW},
  228.   {NM_ITEM,  "Sector Window"  , 0 , 0 , 0      ,(APTR)ID_SECTORWINDOW},
  229.   {NM_ITEM,  "Message window" , 0 , 0 , 0      ,(APTR)ID_MESSAGEWINDOW},
  230.   /*
  231.   {NM_TITLE, "Settings"       , 0 , 0 , 0      ,(APTR)0},
  232.   {NM_ITEM,  "Show Ships"     , 0 , 0 , 0      ,(APTR)MEN_SHOWSHIPS},   
  233.   */
  234.   {NM_END,    NULL            , 0 , 0 , 0      ,(APTR)0},
  235.   };
  236.   
  237.   
  238. static struct Hook fleet_list_dsphook = {
  239.         {NULL, NULL},
  240.         (void *)dispfleet,
  241.         NULL, NULL
  242. };
  243. static struct Hook fleet_list_deshook = {
  244.         {NULL, NULL},
  245.         (void *)desfleet,
  246.         NULL, NULL
  247. };
  248. static struct Hook fleet_list_conhook = {
  249.         {NULL, NULL},
  250.         (void *)consfleet,
  251.         NULL, NULL
  252. };
  253. static struct Hook ship_list_dsphook = {
  254.         {NULL, NULL},
  255.         (void *)dispship,
  256.         NULL, NULL
  257. };
  258. static struct Hook ship_list_deshook = {
  259.         {NULL, NULL},
  260.         (void *)desship,
  261.         NULL, NULL
  262. };
  263. static struct Hook ship_list_conhook = {
  264.         {NULL, NULL},
  265.         (void *)consship,
  266.         NULL, NULL
  267. };
  268.  
  269. static struct Hook fleet_list_dsptag = {
  270.         {NULL, NULL},
  271.         (void *)disptag,
  272.         NULL, NULL
  273. };
  274.  
  275. static struct Hook fleet_list_dsppurch = {
  276.         {NULL, NULL},
  277.         (void *)disppurch,
  278.         NULL, NULL
  279. };
  280.  
  281. static struct Hook fleet_list_destag = {
  282.         {NULL, NULL},
  283.         (void *)destag,
  284.         NULL, NULL
  285. };
  286. static struct Hook fleet_list_contag = {
  287.         {NULL, NULL},
  288.         (void *)constag,
  289.         NULL, NULL
  290. };
  291.  
  292. struct MyData {
  293.    LONG dummy;
  294. };
  295.  
  296.  
  297.  
  298. SAVEDS ULONG mAskMinMax(struct IClass *cl,Object *obj,struct MUIP_AskMinMax *msg){
  299.         DoSuperMethodA(cl,obj,msg);
  300.         msg->MinMaxInfo->MinWidth  += (GALAXY*30);
  301.         msg->MinMaxInfo->DefWidth  += (GALAXY*30);
  302.         msg->MinMaxInfo->MaxWidth  += (GALAXY*30);
  303.         msg->MinMaxInfo->MinHeight += (GALAXY*30);
  304.         msg->MinMaxInfo->DefHeight += (GALAXY*30);
  305.         msg->MinMaxInfo->MaxHeight += (GALAXY*30);
  306.         return(0);
  307. }
  308. SAVEDS ULONG mDraw(struct IClass *cl,Object *obj,struct MUIP_Draw *msg){
  309.         int x,n,m,y,z;
  310.         BOOL enemy=FALSE,friendly=FALSE;
  311.         struct force *fleet;
  312.         struct TagItem *tag;
  313.         
  314.         DoSuperMethodA(cl,obj,msg);
  315.  
  316.         if (!(msg->flags & MADF_DRAWOBJECT)) return(0);
  317.  
  318.         SetAPen(_rp(obj),_dri(obj)->dri_Pens[FILLPEN]);
  319.    
  320.         y = _mtop(obj);
  321.         z = _mleft(obj);
  322.         
  323.         DrawImage(_rp(obj),&mapbackground,z,y);  
  324.         
  325.         for (n=1;n<=GALAXY;n++) {
  326.            Move(_rp(obj),z+n*30,y);
  327.            Draw(_rp(obj),z+n*30,y+GALAXY*30);
  328.         }
  329.         
  330.         for (n=1;n<=GALAXY;n++) {
  331.            Move(_rp(obj),z,y+n*30);
  332.            Draw(_rp(obj),z+GALAXY*30,y+n*30);
  333.         }
  334.  
  335.         SetAPen(_rp(obj),_dri(obj)->dri_Pens[TEXTPEN]); 
  336.         for (x = 0;x<planetnumber;x++) {
  337.           m = planetlist[0][x].x;
  338.           n = planetlist[0][x].y;
  339.           
  340.           if (currentplayer->id == planetlist[0][x].id) DrawImage(_rp(obj),&mapimages1,z+(m*30),y+(n*30));
  341.           /* should be set to currentplayer->id */
  342.           else if (planetlist[currentplayer->id][x].id == 0)
  343.                DrawImage(_rp(obj),&mapimages5,z+(m*30),y+(n*30));
  344.                else DrawImage(_rp(obj),&mapimages6,z+(m*30),y+(n*30));
  345.                           
  346.           PrintIText(_rp(obj),&planetlist[currentplayer->id][x].textattribute,z+(m*30),y+(n*30));        
  347.         }
  348.         
  349.         for (n=0;n<GALAXY;n++) {
  350.           for (m=0;m<GALAXY;m++) {
  351.           if (insector(currentplayer->id,n,m)) {
  352.             tag = SECTOR[n][m].TAGITEM;
  353.             if (NextTagItem(&tag))   
  354.               DrawImage(_rp(obj),&mapimages4,z+(n*30),y+(m*30));
  355.             fleet = SECTOR[n][m].FLEET;
  356.             friendly = enemy = FALSE;
  357.             while (fleet) {
  358.               if (fleet->id == currentplayer->id) friendly = TRUE;
  359.               else enemy = TRUE;
  360.               fleet = fleet->sectornext;
  361.             }
  362.             if (friendly) DrawImage(_rp(obj),&mapimages2,z+(n*30),y+(m*30));
  363.             if (enemy)    DrawImage(_rp(obj),&mapimages3,z+(n*30),y+(m*30));
  364.           }
  365.         }
  366.       }
  367.  
  368.    return(0);
  369. }
  370.  
  371. SAVEDS ULONG mSetup(struct IClass *cl,Object *obj,struct MUIP_HandleInput *msg)
  372. {
  373.         if (!(DoSuperMethodA(cl,obj,msg)))
  374.                 return(FALSE);
  375.  
  376.         MUI_RequestIDCMP(obj,IDCMP_MOUSEBUTTONS|IDCMP_RAWKEY);
  377.  
  378.         return(TRUE);
  379. }
  380.  
  381.  
  382. SAVEDS ULONG mCleanup(struct IClass *cl,Object *obj,struct MUIP_HandleInput *msg)
  383. {
  384.         MUI_RejectIDCMP(obj,IDCMP_MOUSEBUTTONS|IDCMP_RAWKEY);
  385.         return(DoSuperMethodA(cl,obj,msg));
  386. }
  387.  
  388.  
  389.  
  390. static ULONG mHandleInput(
  391.         struct IClass *cl,
  392.         Object *obj,
  393.         struct MUIP_HandleInput *msg)
  394. {
  395. #define _between(a,x,b) ((x)>=(a) && (x)<=(b))
  396. #define _isinobject(x,y) (_between(_mleft(obj),(x),_mright (obj)) && _between(_mtop(obj) ,(y),_mbottom(obj)))
  397.   int n,m,a,b;
  398.      
  399.   struct Data *data = INST_DATA(cl,obj);
  400.      
  401.   if (msg->imsg)
  402.      {
  403.      switch (msg->imsg->Class)
  404.        {
  405.        case IDCMP_MOUSEBUTTONS:
  406.          {
  407.          if (msg->imsg->Code==SELECTDOWN)
  408.            {
  409.            if (_isinobject(msg->imsg->MouseX,msg->imsg->MouseY))
  410.              {
  411.              data->x = msg->imsg->MouseX;
  412.              data->y = msg->imsg->MouseY;
  413.              guiget(client,INT,SC1,MUIA_Virtgroup_Top,&a);
  414.              guiget(client,INT,SC1,MUIA_Virtgroup_Left,&b);
  415.              n = (data->x)+b-16;
  416.              m = (data->y)+a-16;
  417.              if (n > 0) n = n/30;
  418.              if (m > 0) m = m/30;
  419.              if ((m <GALAXY && m >= 0) && (n <GALAXY && n >= 0)) {
  420.                guiset(client,INT,SL41,MUIA_Slider_Level,n);
  421.                guiset(client,INT,SL42,MUIA_Slider_Level,m);
  422.                if (SECTOR[n][m].PLANET) {
  423.                  if (currentplayer) {
  424.                     currentplayer->currentplanet = &planetlist[currentplayer->id][SECTOR[n][m].PLANET->ID];
  425.                     DoMethod(app,MUIM_Application_ReturnID,ID_SETPLANET);
  426.                  }
  427.                  /*
  428.                  guiset(client,INT,LV1,MUIA_List_Active,SECTOR[n][m].PLANET->ID);
  429.                  /* to planet list */
  430.                  guiset(client,INT,LV3,MUIA_List_Active,SECTOR[n][m].PLANET->ID);
  431.                  */
  432.                }
  433.              }
  434.            }                           
  435.          }
  436.          else MUI_RejectIDCMP(obj,IDCMP_MOUSEMOVE);
  437.        }
  438.        break;        
  439.     }
  440.     /* passing MUIM_HandleInput to the super class is only necessary
  441.     if you rely on area class input handling (MUIA_InputMode). */
  442.   }
  443.   return(0);
  444. }
  445.  
  446.  
  447. SAVEDS ASM ULONG MyDispatcher(REG(a0) struct IClass *cl,REG(a2) Object *obj,REG(a1) Msg msg)
  448. {
  449.         switch (msg->MethodID) {
  450.                 case MUIM_AskMinMax: return(mAskMinMax(cl,obj,(APTR)msg));
  451.                 case MUIM_Draw     : return(mDraw     (cl,obj,(APTR)msg));
  452.                 case MUIM_HandleInput: return(mHandleInput(cl,obj,(APTR)msg));
  453.                 case MUIM_Setup      : return(mSetup      (cl,obj,(APTR)msg));
  454.                 case MUIM_Cleanup    : return(mCleanup    (cl,obj,(APTR)msg));
  455.                 case MUIM_MyObjRedraw: return(MUIM_xxx_CallRedraw(cl, obj,(APTR) msg));
  456.         }
  457.         return(DoSuperMethodA(cl,obj,msg));
  458. }
  459.  
  460.  
  461.  
  462.  
  463. main(int argc, char *argv[]) {
  464.  
  465.      
  466.   init();
  467.   
  468.   if (!(SuperClass=MUI_GetClass(MUIC_Area)))
  469.        fail(NULL,"Superclass for the new class not found.");
  470.   /* create the new class */
  471.   if (!(MyClass = MakeClass(NULL,NULL,SuperClass,sizeof(struct MyData),0)))
  472.     {
  473.     MUI_FreeClass(SuperClass);
  474.     fail(NULL,"Failed to create class.");
  475.     }
  476.   /* set the dispatcher for the new class */
  477.   MyClass->cl_Dispatcher.h_Entry    = (APTR)MyDispatcher;
  478.   MyClass->cl_Dispatcher.h_SubEntry = NULL;
  479.   MyClass->cl_Dispatcher.h_Data     = NULL;
  480.   
  481.   srand48(time(NULL));
  482.   
  483.   
  484.  
  485.   app = ApplicationObject,
  486.      MUIA_Application_Title,          "MUIEmpire",
  487.      MUIA_Application_Version,        VERSTAG,
  488.      MUIA_Application_Copyright,      "© 1995, by Karl Bellve",
  489.      MUIA_Application_Author,         "Karl Bellve",
  490.      MUIA_Application_Description,    "The unlimited player, unlimited planet, unlimited ship type conquest game",
  491.      MUIA_Application_Base,           "EMPIRE",
  492.       SubWindow, WI_Fleet = WindowObject,
  493.          MUIA_Window_Title, "Empire Fleet Window",
  494.          MUIA_Window_ID, MAKE_ID('F','L','E','E'),
  495.          WindowContents, VGroup,
  496.              Child, VGroup,
  497.                  Child, lv6 = ListviewObject, MUIA_Listview_Input, TRUE, MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_Default, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  498.                      MUIA_List_Format,"COL=0 MINWIDTH=2,COL=1 MINWIDTH=2,COL=2 MINWIDTH=20,COL=4 MINWIDTH=8,COL=5 MINWIDTH=8,COL=6 MINWIDTH=8,COL=7 MINWIDTH=8,COL=8 MINWIDTH=8,COL=9 MINWIDTH=8,COL=10 MINWIDTH=5,COL=11 MINWIDTH=5, COL=12 MINWIDTH=20",
  499.                      MUIA_List_ConstructHook,&fleet_list_conhook,
  500.                      MUIA_List_DestructHook,&fleet_list_deshook,
  501.                      MUIA_List_DisplayHook,&fleet_list_dsphook,End,
  502.                  End,
  503.                  Child, BT_JoinFleet = KeyButton("Join Fleets",'j'),
  504.              End,
  505.          End,
  506.       End,
  507.          
  508.  
  509.     SubWindow, WI_Sector = WindowObject,
  510.         MUIA_Window_Title, "Sector Information",
  511.         MUIA_Window_ID, MAKE_ID('S','E','C','T'),
  512.         WindowContents, VGroup,
  513.            Child, HGroup,
  514.              Child, VGroup, MUIA_Weight, 200,                                
  515.                Child, ColGroup (2), 
  516.                   Child, Label("X coor:"),
  517.                   Child, sl41 = SliderObject, MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, MUIA_Slider_Level, 0, End,
  518.                   Child, Label("Y coor:"),
  519.                   Child, sl42 = SliderObject, MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, MUIA_Slider_Level, 0, End,
  520.                End,
  521.                Child, lv16 = ListviewObject, MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  522.                    MUIA_List_Format,"COL=2 MINWIDTH=30,COL=3 MINWIDTH=30,COL=4 MINWIDTH=20,COL=5 MINWIDTH=20",
  523.                    MUIA_List_ConstructHook,&fleet_list_conhook,
  524.                    MUIA_List_DestructHook,&fleet_list_deshook,
  525.                    MUIA_List_DisplayHook,&fleet_list_dsphook,End,
  526.                End,
  527.              End,
  528.              Child, lv17=ListviewObject, MUIA_Weight, 50,MUIA_Listview_Input, FALSE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  529.                MUIA_List_Format,"P=/33c MINWIDTH=30,MINWIDTH=70",
  530.                MUIA_List_ConstructHook,&fleet_list_contag,
  531.                MUIA_List_DestructHook,&fleet_list_destag,
  532.                MUIA_List_DisplayHook,&fleet_list_dsptag,End,
  533.              End,              
  534.            End,   
  535.         End,
  536.       End,
  537.      
  538.      SubWindow, WI_Message = WindowObject,
  539.         MUIA_Window_Title, "Empire Message Window",
  540.         MUIA_Window_ID, MAKE_ID('M','E','S','S'),
  541.         WindowContents, HGroup,
  542.              Child, HGroup,                                   
  543.                Child, VGroup, MUIA_Weight, 0,
  544.                  Child, ColGroup(2), GroupFrameT("Player"),  
  545.                    Child, Label("Name:"      ),
  546.                    Child, tx13 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, NULL, End,
  547.                    Child, Label("Empire:"      ),
  548.                    Child, str5 = StringObject, StringFrame, MUIA_String_MaxLen,20,End,
  549.                    Child, Label("Turn:"),
  550.                    Child, tx22 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, NULL, End,                             
  551.                  End, 
  552.                  Child, HGroup,
  553.                    Child, BT_SendMessage = KeyButton("Send Message",'m'),                     
  554.                    Child, BT_ClearMessage = KeyButton("Clear Messages",'c'),                     
  555.                  End, 
  556.                  Child, str7 = StringObject, StringFrame, MUIA_String_MaxLen,100,End,
  557.                  Child, lv18 = ListviewObject,MUIA_Listview_MultiSelect, 
  558.                     MUIV_Listview_MultiSelect_Default, 
  559.                     MUIA_List_Title, "Enemy Empires",InputListFrame,                    
  560.                     MUIA_Listview_Input, TRUE, MUIA_Listview_List, 
  561.                     ListObject,
  562.                     MUIA_List_Format,"COL 1",
  563.                     MUIA_List_ConstructHook,&fleet_list_contag,
  564.                     MUIA_List_DestructHook,&fleet_list_destag,
  565.                     MUIA_List_DisplayHook,&fleet_list_dsptag,End,
  566.                  End,
  567.                End,
  568.                Child, lv15 = ListviewObject, MUIA_Weight, 150,MUIA_Listview_Input, FALSE, MUIA_Listview_List, ListObject, MUIA_List_Title, "Game Messages",InputListFrame, 
  569.                  MUIA_List_ConstructHook,MUIV_List_ConstructHook_String,
  570.                  MUIA_List_DestructHook,MUIV_List_DestructHook_String,End,
  571.                End,    
  572.              End,
  573.           End,
  574.      End, 
  575.  
  576.      SubWindow, WI_Mainwindow = WindowObject,
  577.         MUIA_Window_Title, "Empire Control Window",
  578.         MUIA_Window_ID, MAKE_ID('C','O','N','T'),
  579.         MUIA_Window_Menustrip, strip = MUI_MakeObject(MUIO_MenustripNM,MenuData1,0),
  580.         WindowContents, HGroup,
  581.               Child, HGroup,
  582.                  Child, HGroup,
  583.                    Child, sc1 = ScrollgroupObject, MUIA_HorizWeight, 200,MUIA_Scrollgroup_Contents, vi1 = VGroupV, VirtualFrame,
  584.                        Child, MyObj = NewObject(MyClass,NULL,
  585.                                         MUIA_Background, MUII_BACKGROUND,
  586.                                         TAG_DONE), 
  587.                    End,
  588.                  End,                                                       
  589.                  Child, VGroup, MUIA_HorizWeight, 25,
  590.                     Child, VSpace(0),
  591.                     Child, VGroup, GroupFrameT("Current Planet"),
  592.                        Child, HGroup,
  593.                           Child, BT_LastPlanet = KeyButton("Last",'l'),
  594.                           Child, BT_NextPlanet = KeyButton("Next",'n'), 
  595.                        End,
  596.                        Child, ColGroup(2),
  597.                           Child, Label("Name:"      ),
  598.                           Child, str3 = StringObject, StringFrame, MUIA_String_MaxLen,20,End,
  599.                           Child, Label("Empire:"     ),
  600.                           Child, tx2 = TextObject,MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,
  601.                           Child, Label("Population:"),  
  602.                           Child, tx3 = TextObject,MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,
  603.                           Child, Label("Technology:"),
  604.                           Child, tx4 = TextObject,MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,
  605.                           Child, Label("Fuel:"),
  606.                           Child, tx5 = TextObject,MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,
  607.                           Child, Label("Production:"),
  608.                           Child, tx35 = TextObject,MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "None", End,
  609.                           Child, Label("Tax Rate:"  ),
  610.                           Child, sl32 = SliderObject, MUIA_Slider_Min, 0, MUIA_Slider_Max, 100, MUIA_Slider_Level, 10, End,
  611.                        End,
  612.                     End,
  613.                     Child, ColGroup(2),
  614.                        Child, BT_Purchase = KeyButton("Purchasing",'p'),
  615.                        Child, BT_Movement = KeyButton("Fleet Control",  'f'), 
  616.                        Child, BT_PlanetCargo = KeyButton("Inventory",'i'), 
  617.                        Child, BT_NextPlayer = SimpleButton("Done"), 
  618.                     End,
  619.                     Child, VSpace(0),
  620.                  End,
  621.               End,
  622.           End,
  623.           End,      
  624.      End,
  625.     
  626.     SubWindow, WI_Gauge = WindowObject,
  627.         MUIA_Window_Title, "Computer is thinking ...",
  628.         MUIA_Window_ID, MAKE_ID('C','I','T','H'),
  629.         WindowContents, VGroup, GroupSpacing(1),
  630.             Child, VGroup,
  631.               Child, gauge1 = GaugeObject, GaugeFrame, MUIA_FixWidth, 250, MUIA_Gauge_Horiz,TRUE, MUIA_Gauge_InfoText,"    ",End,
  632.               Child, ScaleObject, End,
  633.             End,
  634.           End,         
  635.         End,
  636. /*
  637.     SubWindow, WI_Login = WindowObject,
  638.         MUIA_Window_Title, "Empire Login",
  639.         MUIA_Window_ID, MAKE_ID('L','O','G','N'),
  640.         WindowContents, VGroup,
  641.               Child, VGroup,
  642.                  Child, ColGroup (2), GroupFrame,
  643.                     Child, Label("Name:"),
  644.                     Child, str13 = StringObject, StringFrame, MUIA_String_MaxLen, 30,End,             
  645.                     Child, Label("Password:"),
  646.                     Child, str14 = StringObject, StringFrame, MUIA_String_Secret,MUIA_String_MaxLen, 30,End,             
  647.                     Child, Label("Game:"),
  648.                     Child, str15 = StringObject, StringFrame, MUIA_String_MaxLen, 30,End,                        
  649.                  End,
  650.                  Child, BT_PlayGame = KeyButton("Play Game",'p'),
  651.               End,   
  652.            End,         
  653.         End,
  654. */
  655.      SubWindow, WI_PlanetCargo = WindowObject,
  656.         MUIA_Window_Title, "Cargo Operations",
  657.         MUIA_Window_ID, MAKE_ID('P','L','C','A'),
  658.         WindowContents, VGroup,           
  659.               Child, reg2 = RegisterGroup(pages4), 
  660.                  Child, VGroup,
  661.                    Child, VGroup,
  662.                      Child, lv8 = ListviewObject, MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  663.                          MUIA_List_Format,"P=/33c MINWIDTH=30,MINWIDTH=70",
  664.                          MUIA_List_ConstructHook,&fleet_list_contag,
  665.                          MUIA_List_DestructHook,&fleet_list_destag,
  666.                          MUIA_List_DisplayHook,&fleet_list_dsptag,
  667.                          End,
  668.                      End,
  669.                    End,  
  670.                    Child, VGroup,
  671.                      Child, BT_PlanetTransferSec = KeyButton("Transfer to Sector",'t'),
  672.                      Child, BT_SellGoods         = KeyButton("Convert to Credits",'c'),
  673.                      Child, Hypergroup = VGroup, GroupFrame,
  674.                        Child, BT_Hyper = KeyButton("Hyper Transfer",'h'),                     
  675.                        Child, ColGroup (2), GroupFrameT("To Sector"),
  676.                        Child, Label("X coor:"),
  677.                        Child, sl43 = SliderObject, MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, MUIA_Slider_Level, 0, End,
  678.                        Child, Label("Y coor:"),
  679.                        Child, sl44 = SliderObject, MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, MUIA_Slider_Level, 0, End,
  680.                      End,
  681.                    End,
  682.                  End,
  683.               End,  
  684.                  Child, VGroup,
  685.                    Child, VGroup,
  686.                      Child, lv7 = ListviewObject, MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  687.                          MUIA_List_Format,"P=/33c MINWIDTH=30,MINWIDTH=70",
  688.                          MUIA_List_ConstructHook,&fleet_list_contag,
  689.                          MUIA_List_DestructHook,&fleet_list_destag,
  690.                          MUIA_List_DisplayHook,&fleet_list_dsptag,
  691.                      End,
  692.                    End,
  693.                    Child, VGroup, 
  694.                      Child, BT_SectorTransferPla = KeyButton("Transfer to Planet",'t'), 
  695.                    End,               
  696.                  End,    
  697.                 End,    
  698.               End,
  699.  
  700.             Child, ColGroup(2), GroupFrame,            
  701.                 Child, Label("Quantity:"),
  702.                 Child, sl33 = SliderObject,  MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, End,
  703.               End,
  704.           End,
  705.         End,
  706.      
  707.      SubWindow, WI_FleetCargo = WindowObject,
  708.         MUIA_Window_Title, "Cargo Operations",
  709.         MUIA_Window_ID, MAKE_ID('F','L','C','A'),
  710.         WindowContents, VGroup,           
  711.               Child, reg2 = RegisterGroup(pages5),    
  712.                  Child, VGroup,
  713.                    Child, VGroup,
  714.                      Child, lv9 = ListviewObject, MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  715.                          MUIA_List_Format,"P=/33c MINWIDTH=30,MINWIDTH=70",
  716.                          MUIA_List_ConstructHook,&fleet_list_contag,
  717.                          MUIA_List_DestructHook,&fleet_list_destag,
  718.                          MUIA_List_DisplayHook,&fleet_list_dsptag,
  719.                      End,
  720.                    End,
  721.                    Child, HGroup, 
  722.                      Child, BT_SectorTransferFle = KeyButton("Transfer to Fleet",'t'),
  723.                   End,
  724.                  End,  
  725.                  End,    
  726.                  Child, VGroup,
  727.                    Child, VGroup,
  728.                      Child, lv10 = ListviewObject, MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  729.                          MUIA_List_Format,"P=/33c MINWIDTH=30,MINWIDTH=70",
  730.                          MUIA_List_ConstructHook,&fleet_list_contag,
  731.                          MUIA_List_DestructHook,&fleet_list_destag,
  732.                          MUIA_List_DisplayHook,&fleet_list_dsptag,
  733.                      End,
  734.                    End,
  735.                    Child, HGroup, 
  736.                      Child, BT_FleetTransferSec = KeyButton("Transfer to Sector",'t'),
  737.                    End,
  738.                  End,
  739.               End,
  740.  
  741.             End,
  742.             Child, ColGroup(2), GroupFrame,            
  743.                 Child, Label("Quantity:"),
  744.                 Child, sl34 = SliderObject,  MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, End,
  745.               End,
  746.           End,
  747.         End,   
  748.      SubWindow, WI_Configuration = WindowObject,
  749.         MUIA_Window_Title, "Configuration",
  750.         MUIA_Window_ID, MAKE_ID('C','O','N','F'),
  751.         WindowContents, VGroup,
  752.            Child, ColGroup(2),
  753.              Child, Label("Planets:"),
  754.              Child, str6 = StringObject, StringFrame, MUIA_String_Accept,"0123456789",MUIA_String_Integer, 40,MUIA_String_MaxLen,10,End,          
  755.            End,
  756.            Child, VGroup, GroupFrameT("Players"),
  757.              Child, HSpace(0),
  758.              Child, lv2 = ListviewObject,MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, InputListFrame, 
  759.                  MUIA_List_ConstructHook,MUIV_List_ConstructHook_String,
  760.                  MUIA_List_DestructHook,MUIV_List_DestructHook_String,
  761.                End,
  762.              End,
  763.              Child, ColGroup(2), 
  764.                Child, Label2("Name:"),
  765.                Child, str1 = StringObject, StringFrame, MUIA_String_MaxLen,20,End,
  766.              End,
  767.              Child, VSpace(0),
  768.              Child, BT_AddPlayer    = KeyButton("Add Player",'a'),
  769.              Child, BT_RemovePlayer = KeyButton("Remove Player",'r'),
  770.              Child, BT_LoadGame     = KeyButton("Load Game",'l'),
  771.              Child, VSpace(0),
  772.            End,
  773.            Child, HGroup, MUIA_Group_SameSize, TRUE,
  774.              Child, BT_Done   = KeyButton("Done",'d'),
  775.              Child, BT_Cancel = KeyButton("Cancel",'>'),
  776.            End,
  777.         End,
  778.      End,
  779.      
  780.      SubWindow, WI_Purchase = WindowObject,
  781.         MUIA_Window_Title, "Purchasing",
  782.         MUIA_Window_ID, MAKE_ID('P','U','R','C'),
  783.         WindowContents, HGroup,
  784.             Child, VGroup,GroupFrame, MUIA_Weight, 150,
  785.               Child, lv11 = ListviewObject,MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  786.                          MUIA_List_Format,",,,,,,",
  787.                          MUIA_List_ConstructHook,&ship_list_conhook,
  788.                          MUIA_List_DestructHook,&ship_list_deshook,
  789.                          MUIA_List_DisplayHook,&ship_list_dsphook,
  790.                  End,
  791.               End,
  792.               Child, ColGroup(2), GroupFrame,            
  793.                    Child, Label("Name:"      ),
  794.                    Child, str8 = StringObject, StringFrame, MUIA_String_MaxLen,30,End,                           
  795.                    Child, Label("Quantity:"),
  796.                    Child, sl35 = SliderObject,  MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, End,
  797.               End,  
  798.               Child, HGroup,  
  799.                 Child, BT_PurchaseShip    = KeyButton("Purchase Ship",'s'),
  800.                 Child, BT_ShipDesign      = KeyButton("Design Ship",'d'),
  801.                 Child, BT_SetProduction   = KeyButton("Production",'r'),
  802.                 Child, BT_ClearProduction = KeyButton("Clear Production",'c'),
  803.               End,
  804.             End,
  805.             Child, VGroup,GroupFrame, MUIA_Weight, 75, 
  806.               Child, lv4 = ListviewObject, MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  807.                          MUIA_List_Format,"MINWIDTH=30,MINWIDTH=70",
  808.                          MUIA_List_ConstructHook,&fleet_list_contag,
  809.                          MUIA_List_DestructHook,&fleet_list_destag,
  810.                          MUIA_List_DisplayHook,&fleet_list_dsppurch,End,
  811.               End,
  812.               Child, ColGroup(2), GroupFrame,            
  813.                  Child, Label("Quantity:"),
  814.                  Child, sl1 = SliderObject,  MUIA_Slider_Min, 0, MUIA_Slider_Max, 99999, End,
  815.               End,
  816.               Child, HGroup, MUIA_Group_SameSize, TRUE,
  817.                 Child, BT_MakePurchase = KeyButton("Purchase Item",'p'),
  818.               End,
  819.             End,        
  820.         End,     
  821.      End,
  822.  
  823.      SubWindow, WI_Movement = WindowObject,
  824.         MUIA_Window_Title, "Ship Movement",
  825.         MUIA_Window_ID, MAKE_ID('M','O','V','E'),
  826.         WindowContents, VGroup,
  827.           Child, HGroup,
  828.             Child, VGroup,
  829.               Child, ColGroup (2),
  830.                 Child, Label("From Sector:"),
  831.                 Child, tx25 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "                               ", End,             
  832.                 Child, Label("To Sector:"),
  833.                 Child, tx26 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "                               ", End,             
  834.                 Child, Label("Distance:"),
  835.                 Child, tx27 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,             
  836.                 Child, Label("Fuel Required:"),
  837.                 Child, tx28 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,             
  838.               End,
  839.               Child, VGroup, GroupFrameT("Current Fleet"),
  840.                 Child, BT_Showships = TextObject, MUIA_Text_PreParse, "\33c",MUIA_Frame, MUIV_Frame_Button, MUIA_InputMode, MUIV_InputMode_Toggle,MUIA_Text_Contents, "Show Ships", End,             
  841.                 Child, lv12 = ListviewObject, MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_Default,MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, MUIA_List_Title, TRUE,InputListFrame,
  842.                     MUIA_List_Format,"COL=1",
  843.                     MUIA_List_ConstructHook,&fleet_list_contag,
  844.                     MUIA_List_DestructHook,&fleet_list_destag,
  845.                     MUIA_List_DisplayHook,&fleet_list_dsptag,End,
  846.                 End,
  847.               End, 
  848.             End,
  849.             Child, VGroup,
  850.               Child, pcy2 = Cycle(pages2),
  851.               Child, pgr2 = PageGroup,
  852.                 Child, VGroup, GroupFrame,
  853.                   Child, ColGroup (2), GroupFrameT("To Sector"),
  854.                     Child, Label("X coor:"),
  855.                     Child, sl17 = SliderObject, MUIA_Slider_Min, 0, MUIA_Slider_Max, 9999, MUIA_Slider_Level, 0, End,
  856.                     Child, Label("Y coor:"),
  857.                     Child, sl18 = SliderObject, MUIA_Slider_Min, 0, MUIA_Slider_Max, 9999, MUIA_Slider_Level, 0, End,
  858.                   End,
  859.                   Child, lv3 = ListviewObject, MUIA_Frame,MUIV_Frame_InputList, MUIA_Listview_Input, TRUE, MUIA_Listview_List, ListObject, InputListFrame, 
  860.                     MUIA_List_ConstructHook,MUIV_List_ConstructHook_String,
  861.                     MUIA_List_DestructHook,MUIV_List_DestructHook_String, End,             
  862.                   End,
  863.                   Child, BT_PlotCourse = SimpleButton("Plot Course"),
  864.                 End,
  865.                 Child, VGroup, GroupFrame,
  866.                   Child, ColGroup (2),
  867.                     Child, tx33 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "Here:", End,             
  868.                     Child, pop1 = PoplistObject,MUIA_Popstring_String, str11 = String(0,30), MUIA_Popstring_Button, PopButton(MUII_PopUp),MUIA_Poplist_Array,popitem, End,
  869.                     Child, Label("Limit:"),
  870.                     Child, str9 = StringObject, StringFrame, MUIA_String_Accept,"0123456789",MUIA_String_Integer, 1000,MUIA_String_MaxLen,10,End,          
  871.                   End,
  872.                   Child, ColGroup (2), GroupFrame, 
  873.                     Child, tx34 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "There:", End,             
  874.                     Child, pop2 = PoplistObject,MUIA_Popstring_String, str12 = String(0,30), MUIA_Popstring_Button, PopButton(MUII_PopUp),MUIA_Poplist_Array,popitem, End,                 
  875.                     Child, Label("Limit:"),
  876.                     Child, str10 = StringObject, StringFrame, MUIA_String_Accept,"0123456789",MUIA_String_Integer, 1000,MUIA_String_MaxLen,10,End,          
  877.                   End,
  878.                   Child, HGroup, MUIA_Group_SameSize, TRUE,
  879.                     Child, BT_ApplyTrade   = KeyButton("Apply Orders" ,'A'),
  880.                     Child, BT_CancelTrade  = KeyButton("Cancel Orders",'C'),
  881.                   End,
  882.                 End,
  883.               End,    
  884.             End,
  885.           End,
  886.           Child, HGroup,
  887.             Child, BT_LastForce   = KeyButton("Last Force"  ,'l'),
  888.             Child, BT_NextForce   = KeyButton("Next Force"  ,'n'), 
  889.             Child, BT_FleetCargo  = KeyButton("Freight"     ,'r'),
  890.             Child, BT_AutoFuel    = KeyButton("Fuel Fleet"  ,'g'), 
  891.             Child, BT_ClearCourse = KeyButton("Clear Course",'c'), 
  892.             Child, BT_SendPartial = KeyButton("New Fleet"   ,'f'),
  893.             Child, BT_Sellship    = KeyButton("Sell Ship"   ,'s'),
  894.           End,
  895.       End,
  896.    End,
  897.  
  898.    SubWindow, WI_ShipDesign = WindowObject,
  899.         MUIA_Window_Title, "Ship Design",
  900.         MUIA_Window_ID, MAKE_ID('S','H','I','P'),
  901.         WindowContents, VGroup,
  902.             Child, ColGroup(2), GroupFrame,            
  903.                  Child, Label2("Ship Class:"),
  904.                  Child, str4 = StringObject, StringFrame, MUIA_String_MaxLen,20,MUIA_String_Contents, "New Ship Class",End,
  905.                  Child, Label("Offense:"),
  906.                  Child, sl36 = SliderObject,  MUIA_Slider_Min, 1, MUIA_Slider_Max, 100, End,
  907.                  Child, Label("Defense:"),
  908.                  Child, sl37 = SliderObject,  MUIA_Slider_Min, 1, MUIA_Slider_Max, 100, End,
  909.                  Child, Label("Cargo:"),
  910.                  Child, sl40 = SliderObject,  MUIA_Slider_Min, 1, MUIA_Slider_Max, 100, End,
  911.                  Child, Label("Speed:"),
  912.                  Child, sl38 = SliderObject,  MUIA_Slider_Min, 1, MUIA_Slider_Max, 10, End,
  913.                  Child, Label("Fuel/Sector:"),
  914.                  Child, sl39 = SliderObject,  MUIA_Slider_Min, 1, MUIA_Slider_Max, 10, End,
  915.                  Child, Label ("Production Cost:"),
  916.                  Child, tx29 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,             
  917.                  Child, Label ("Design Cost:"),
  918.                  Child, tx30 = TextObject, MUIA_Text_PreParse, "\33c", MUIA_Text_Contents, "0", End,             
  919.             End,       
  920.             Child, BT_PurchaseDesign = KeyButton("Purchase Design",'d'),
  921.           End,       
  922.      End, 
  923.    End;     
  924.  
  925.      
  926.   /* load save settings */
  927.   DoMethod(app,MUIM_Application_Load,MUIV_Application_Load_ENVARC);
  928.   
  929.    
  930.   DoMethod(BT_Purchase      ,MUIM_Notify,MUIA_Pressed,FALSE,WI_Purchase,3,MUIM_Set,MUIA_Window_Open,TRUE);
  931.   DoMethod(BT_FleetCargo    ,MUIM_Notify,MUIA_Pressed,FALSE,WI_FleetCargo,3,MUIM_Set,MUIA_Window_Open,TRUE);
  932.   DoMethod(BT_PlanetCargo   ,MUIM_Notify,MUIA_Pressed,FALSE,WI_PlanetCargo,3,MUIM_Set,MUIA_Window_Open,TRUE);
  933.   DoMethod(BT_Map           ,MUIM_Notify,MUIA_Pressed,FALSE,WI_Map     ,3,MUIM_Set,MUIA_Window_Open,TRUE);
  934.   DoMethod(BT_Movement      ,MUIM_Notify,MUIA_Pressed,FALSE,WI_Movement,3,MUIM_Set,MUIA_Window_Open,TRUE);
  935.   DoMethod(BT_ShipDesign    ,MUIM_Notify,MUIA_Pressed,FALSE,WI_ShipDesign,3,MUIM_Set,MUIA_Window_Open,TRUE);
  936.  
  937.   DoMethod(WI_Movement      ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_Movement   ,3,MUIM_Set,MUIA_Window_Open,FALSE);
  938.   DoMethod(WI_PlanetCargo   ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_PlanetCargo ,3,MUIM_Set,MUIA_Window_Open,FALSE);
  939.   DoMethod(WI_FleetCargo    ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_FleetCargo ,3,MUIM_Set,MUIA_Window_Open,FALSE);
  940.   DoMethod(WI_Purchase      ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_Purchase,3,MUIM_Set,MUIA_Window_Open,FALSE);
  941.   DoMethod(WI_Map           ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_Map,3,MUIM_Set,MUIA_Window_Open,FALSE);
  942.   DoMethod(WI_Configuration ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_Map,3,MUIM_Set,MUIA_Window_Open,FALSE);
  943.   DoMethod(WI_ShipDesign    ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_ShipDesign,3,MUIM_Set,MUIA_Window_Open,FALSE);
  944.   DoMethod(WI_Fleet         ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_Fleet,3,MUIM_Set,MUIA_Window_Open,FALSE);
  945.   DoMethod(WI_Sector        ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_Sector,3,MUIM_Set,MUIA_Window_Open,FALSE);
  946.   DoMethod(WI_Message       ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,WI_Message,3,MUIM_Set,MUIA_Window_Open,FALSE);
  947.   
  948.   DoMethod(BT_LoadGame      ,MUIM_Notify,MUIA_Pressed,FALSE,WI_Configuration,3,MUIM_Set,MUIA_Window_Open,FALSE);
  949.   
  950.  
  951.   DoMethod(WI_Mainwindow,MUIM_Notify,MUIA_Window_CloseRequest,
  952.     TRUE,app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  953.   DoMethod(BT_Quit,MUIM_Notify,MUIA_Pressed,
  954.     FALSE,app,2,MUIM_Application_ReturnID,ID_QUIT);
  955.   DoMethod(WI_Configuration,MUIM_Notify,MUIA_Window_CloseRequest,
  956.     TRUE,app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  957.   DoMethod(BT_Cancel,MUIM_Notify,MUIA_Pressed,
  958.     FALSE,app,2,MUIM_Application_ReturnID,ID_CANCEL);
  959.   DoMethod(BT_SendPartial,MUIM_Notify,MUIA_Pressed,
  960.     FALSE,app,2,MUIM_Application_ReturnID,ID_SENDPARTIAL); 
  961.   
  962.   DoMethod(BT_ClearCourse,MUIM_Notify,MUIA_Pressed,
  963.     FALSE,app,2,MUIM_Application_ReturnID,ID_CLEARCOURSE);
  964.   
  965.   DoMethod(BT_Hyper,MUIM_Notify,MUIA_Pressed,
  966.     FALSE,app,2,MUIM_Application_ReturnID,ID_HYPER);  
  967.  
  968.   DoMethod(BT_LoadGame,MUIM_Notify,MUIA_Pressed,
  969.     FALSE,app,2,MUIM_Application_ReturnID,MEN_LOADGAME); 
  970.   DoMethod(BT_AutoFuel,MUIM_Notify,MUIA_Pressed,
  971.     FALSE,app,2,MUIM_Application_ReturnID,ID_AUTOFUEL); 
  972.  
  973.   DoMethod(BT_SendMessage,MUIM_Notify,MUIA_Pressed,
  974.     FALSE,app,2,MUIM_Application_ReturnID,ID_SENDMESSAGE);
  975.   DoMethod(BT_ClearMessage,MUIM_Notify,MUIA_Pressed,
  976.     FALSE,app,2,MUIM_Application_ReturnID,ID_CLEARMESSAGE);
  977.   DoMethod(str3,MUIM_Notify,MUIA_String_Acknowledge,
  978.     MUIV_EveryTime,app,2,MUIM_Application_ReturnID,ID_NEWNAME);
  979.   DoMethod(str5,MUIM_Notify,MUIA_String_Acknowledge,
  980.     MUIV_EveryTime,app,2,MUIM_Application_ReturnID,ID_NEWNAME);
  981.   DoMethod(str8,MUIM_Notify,MUIA_String_Acknowledge,
  982.     MUIV_EveryTime,app,2,MUIM_Application_ReturnID,ID_SHIPNAME);
  983.     
  984.   DoMethod(BT_ApplyTrade,MUIM_Notify,MUIA_Pressed,
  985.     FALSE,app,2,MUIM_Application_ReturnID,ID_APPLYTRADE);
  986.   
  987.   DoMethod(BT_CancelTrade,MUIM_Notify,MUIA_Pressed,
  988.     FALSE,app,2,MUIM_Application_ReturnID,ID_CANCELTRADE);
  989.   
  990.   DoMethod(BT_SetProduction,MUIM_Notify,MUIA_Pressed,
  991.     FALSE,app,2,MUIM_Application_ReturnID,ID_SETPRODUCTION);
  992.   DoMethod(BT_ClearProduction,MUIM_Notify,MUIA_Pressed,
  993.     FALSE,app,2,MUIM_Application_ReturnID,ID_CLEARPRODUCTION);
  994.  
  995.   DoMethod(sl32,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  996.    app,2,MUIM_Application_ReturnID,ID_NEWTAX);
  997.   DoMethod(BT_PlanetTransferSec,MUIM_Notify,MUIA_Pressed,
  998.     FALSE,app,2,MUIM_Application_ReturnID,ID_PLANETTRANSFERSEC);
  999.   DoMethod(BT_SectorTransferPla,MUIM_Notify,MUIA_Pressed,
  1000.     FALSE,app,2,MUIM_Application_ReturnID,ID_SECTORTRANSFERPLA);  
  1001.   DoMethod(BT_FleetTransferSec,MUIM_Notify,MUIA_Pressed,
  1002.     FALSE,app,2,MUIM_Application_ReturnID,ID_FLEETTRANSFERSEC);
  1003.   DoMethod(BT_PurchaseDesign,MUIM_Notify,MUIA_Pressed,
  1004.     FALSE,app,2,MUIM_Application_ReturnID,ID_PURCHASEDESIGN);
  1005.   DoMethod(BT_PurchaseShip,MUIM_Notify,MUIA_Pressed,
  1006.     FALSE,app,2,MUIM_Application_ReturnID,ID_PURCHASESHIP); 
  1007.   DoMethod(BT_SellGoods,MUIM_Notify,MUIA_Pressed,
  1008.     FALSE,app,2,MUIM_Application_ReturnID,ID_SELLGOODS);  
  1009.   DoMethod(BT_JoinFleet,MUIM_Notify,MUIA_Pressed,
  1010.     FALSE,app,2,MUIM_Application_ReturnID,ID_JOINFLEET);    
  1011.   
  1012.   DoMethod(BT_Sellship,MUIM_Notify,MUIA_Pressed,
  1013.     FALSE,app,2,MUIM_Application_ReturnID,ID_SELLSHIP); 
  1014.   
  1015.   DoMethod(BT_Showships,MUIM_Notify,MUIA_Selected,
  1016.     FALSE,lv12,3,MUIM_Set, MUIA_ShowMe, FALSE); 
  1017.     
  1018.   DoMethod(BT_Showships,MUIM_Notify,MUIA_Selected,
  1019.     TRUE,lv12,3,MUIM_Set, MUIA_ShowMe, TRUE);   
  1020.   DoMethod(BT_Showships,MUIM_Notify,MUIA_Pressed,
  1021.     FALSE,lv12,3,MUIM_Set, MUIA_ShowMe, FALSE); 
  1022.   DoMethod(BT_Showships,MUIM_Notify,MUIA_Selected,
  1023.     TRUE,BT_Sellship,3,MUIM_Set, MUIA_Disabled, FALSE);  
  1024.   DoMethod(BT_Showships,MUIM_Notify,MUIA_Selected,
  1025.     TRUE,BT_SendPartial,3,MUIM_Set, MUIA_Disabled, FALSE);  
  1026.     
  1027.   DoMethod(BT_Showships,MUIM_Notify,MUIA_Selected,
  1028.     FALSE,BT_Sellship,3,MUIM_Set, MUIA_Disabled, TRUE);  
  1029.   DoMethod(BT_Showships,MUIM_Notify,MUIA_Selected,
  1030.     FALSE,BT_SendPartial,3,MUIM_Set, MUIA_Disabled, TRUE); 
  1031.  
  1032.     
  1033.   DoMethod(BT_SectorTransferFle,MUIM_Notify,MUIA_Pressed,
  1034.     FALSE,app,2,MUIM_Application_ReturnID,ID_SECTORTRANSFERFLE);
  1035.   DoMethod(BT_MakePurchase,MUIM_Notify,MUIA_Pressed,
  1036.     FALSE,app,2,MUIM_Application_ReturnID,ID_PURCHASE);
  1037.   DoMethod(BT_PlotCourse,MUIM_Notify,MUIA_Pressed,
  1038.     FALSE,app,2,MUIM_Application_ReturnID,ID_PLOTCOURSE);
  1039.   DoMethod(BT_Done,MUIM_Notify,MUIA_Pressed,
  1040.     FALSE,app,2,MUIM_Application_ReturnID,ID_DONE);
  1041.   DoMethod(BT_NextForce,MUIM_Notify,MUIA_Pressed,
  1042.     FALSE,app,2,MUIM_Application_ReturnID,ID_NEXTFORCE);
  1043.   DoMethod(BT_LastForce,MUIM_Notify,MUIA_Pressed,
  1044.     FALSE,app,2,MUIM_Application_ReturnID,ID_LASTFORCE);
  1045.   DoMethod(BT_NextPlayer,MUIM_Notify,MUIA_Pressed,
  1046.     FALSE,app,2,MUIM_Application_ReturnID,ID_NEXTPLAYER);
  1047.   DoMethod(BT_LastPlayer,MUIM_Notify,MUIA_Pressed,
  1048.     FALSE,app,2,MUIM_Application_ReturnID,ID_LASTPLAYER);
  1049.   DoMethod(str1,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,
  1050.     app,2,MUIM_Application_ReturnID,ID_ADDPLAYER);
  1051.   DoMethod(lv2,MUIM_Notify,MUIA_Listview_DoubleClick,MUIV_EveryTime,
  1052.     app,2,MUIM_Application_ReturnID,ID_SETSTRING);
  1053.   DoMethod(BT_NextPlanet,MUIM_Notify,MUIA_Pressed,
  1054.     FALSE,app,2,MUIM_Application_ReturnID,ID_NEXTPLANET);
  1055.   DoMethod(BT_LastPlanet,MUIM_Notify,MUIA_Pressed,
  1056.     FALSE,app,2,MUIM_Application_ReturnID,ID_LASTPLANET);
  1057.   DoMethod(BT_Movement,MUIM_Notify,MUIA_Pressed,
  1058.     FALSE,app,2,MUIM_Application_ReturnID,ID_MOVEMENT);
  1059.   DoMethod(lv1,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1060.     app,2,MUIM_Application_ReturnID,ID_DISPLAY);
  1061.   
  1062.     
  1063.   DoMethod(lv11,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1064.     app,2,MUIM_Application_ReturnID,ID_BUYSHIP);
  1065.     
  1066.   DoMethod(lv6,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1067.     app,2,MUIM_Application_ReturnID,ID_SETFLEET);
  1068.   
  1069.   DoMethod(lv16,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1070.     app,2,MUIM_Application_ReturnID,ID_SHOWSHIPS);
  1071.   
  1072.   DoMethod(sl36,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime, 
  1073.     app,2,MUIM_Application_ReturnID,ID_DESIGNCOST);
  1074.   DoMethod(sl37,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime, 
  1075.     app,2,MUIM_Application_ReturnID,ID_DESIGNCOST);
  1076.   DoMethod(sl38,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime, 
  1077.     app,2,MUIM_Application_ReturnID,ID_DESIGNCOST);
  1078.   DoMethod(sl39,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime, 
  1079.     app,2,MUIM_Application_ReturnID,ID_DESIGNCOST);
  1080.   DoMethod(sl40,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime, 
  1081.     app,2,MUIM_Application_ReturnID,ID_DESIGNCOST);
  1082.   DoMethod(sl41,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime, 
  1083.     app,2,MUIM_Application_ReturnID,ID_SECTORINFO);
  1084.   DoMethod(sl42,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime, 
  1085.     app,2,MUIM_Application_ReturnID,ID_SECTORINFO);  
  1086.     
  1087.    
  1088.   DoMethod(lv3,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1089.     app,2,MUIM_Application_ReturnID,ID_TOPLANET);
  1090.   DoMethod(lv7,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1091.     app,2,MUIM_Application_ReturnID,ID_FROMSECTOR1);
  1092.   DoMethod(lv8,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1093.     app,2,MUIM_Application_ReturnID,ID_FROMPLANET);
  1094.   DoMethod(lv10,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1095.     app,2,MUIM_Application_ReturnID,ID_FROMFLEET);
  1096.   DoMethod(lv9,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime, 
  1097.     app,2,MUIM_Application_ReturnID,ID_FROMSECTOR2);
  1098.   DoMethod(BT_AddPlayer,MUIM_Notify,MUIA_Pressed,FALSE, 
  1099.     app,2,MUIM_Application_ReturnID,ID_ADDPLAYER);
  1100.   DoMethod(sl10,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1101.     app,2,MUIM_Application_ReturnID,ID_FUEL);
  1102.   DoMethod(sl11,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1103.     app,2,MUIM_Application_ReturnID,ID_FUEL);
  1104.   DoMethod(sl12,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1105.     app,2,MUIM_Application_ReturnID,ID_FUEL);
  1106.   DoMethod(sl13,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1107.     app,2,MUIM_Application_ReturnID,ID_FUEL);
  1108.   DoMethod(sl14,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1109.     app,2,MUIM_Application_ReturnID,ID_FUEL);
  1110.   DoMethod(sl15,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1111.     app,2,MUIM_Application_ReturnID,ID_FUEL);
  1112.   DoMethod(sl17,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1113.     app,2,MUIM_Application_ReturnID,ID_DESTINATION);
  1114.   DoMethod(sl18,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1115.     app,2,MUIM_Application_ReturnID,ID_DESTINATION);
  1116.   DoMethod(sl10,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1117.    app,2,MUIM_Application_ReturnID,ID_CARGO);
  1118.   DoMethod(sl8,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1119.    app,2,MUIM_Application_ReturnID,ID_CARGO);
  1120.   DoMethod(sl9,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1121.    app,2,MUIM_Application_ReturnID,ID_CARGO);
  1122.   DoMethod(sl16,MUIM_Notify,MUIA_Slider_Level,MUIV_EveryTime,
  1123.    app,2,MUIM_Application_ReturnID,ID_CARGO);
  1124.   DoMethod(lv1,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime,
  1125.     app,2,MUIM_Application_ReturnID,ID_ENABLEPURCHASE);
  1126.   DoMethod(lv4,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime,
  1127.     app,2,MUIM_Application_ReturnID,ID_ITEMCOST);  
  1128.   DoMethod(BT_RemovePlayer,MUIM_Notify,MUIA_Pressed,FALSE,
  1129.     lv2,2,MUIM_List_Remove,MUIV_List_Remove_Active);
  1130.  
  1131.  
  1132.   DoMethod(WI_Configuration,MUIM_Window_SetCycleChain,str6,lv2,str1,
  1133.      BT_AddPlayer,BT_RemovePlayer,BT_Done,BT_Cancel,NULL);
  1134.   DoMethod(WI_Movement,MUIM_Window_SetCycleChain,lv12,sl17,sl18,lv3,
  1135.      BT_LastForce,BT_NextForce,BT_FleetCargo,BT_AutoFuel,BT_ClearCourse,BT_SendPartial,
  1136.      BT_Sellship, pop1,str9,pop2,str10,BT_ApplyTrade,BT_CancelTrade,NULL);
  1137.     
  1138.   DoMethod(WI_Mainwindow,MUIM_Window_SetCycleChain,BT_LastPlanet,
  1139.     BT_NextPlanet,str3,sl32,lv1,BT_LastPlayer,BT_NextPlayer,BT_Map,BT_Purchase,
  1140.     BT_Movement,BT_PlanetCargo,lv6,str5,sl41,sl42,lv16,lv17,NULL); 
  1141.   
  1142.   DoMethod(WI_Purchase,MUIM_Window_SetCycleChain,lv11,sl35,BT_PurchaseShip,BT_ShipDesign,lv4,
  1143.     sl1,BT_MakePurchase,NULL);   
  1144.  
  1145. /*
  1146.   DoMethod(pcy1,MUIM_Notify,MUIA_Cycle_Active,MUIV_EveryTime,
  1147.      pgr1,3,MUIM_Set,MUIA_Group_ActivePage,MUIV_TriggerValue);
  1148. */  
  1149.   DoMethod(pcy2,MUIM_Notify,MUIA_Cycle_Active,MUIV_EveryTime,
  1150.      pgr2,3,MUIM_Set,MUIA_Group_ActivePage,MUIV_TriggerValue);
  1151.  
  1152.   DoMethod(app,MUIM_Application_Load,MUIV_Application_Load_ENVARC);
  1153.   
  1154.   if (!app) fail(app,"Failed to create application.");
  1155.  
  1156.   set(BT_Showships,MUIA_Selected,TRUE); 
  1157.   core(); 
  1158.   
  1159.   DoMethod(app,MUIM_Application_Save,MUIV_Application_Save_ENVARC);
  1160.   set(WI_Configuration,MUIA_Window_Open,FALSE);         
  1161.   set(WI_Mainwindow,MUIA_Window_Open,FALSE);
  1162.   
  1163.   MUI_DisposeObject(app);
  1164.     
  1165.   FreeClass(MyClass);          /* free our custom class.         */
  1166.   MUI_FreeClass(SuperClass);   /* release super class pointer.   */
  1167.   
  1168.                                /* save export ids                */
  1169.   fail(NULL,NULL);             /* exit, app is already disposed. */
  1170. }
  1171.  
  1172.  
  1173.  
  1174. __saveds __asm struct shiptag *consship(register __a0 struct Hook *hook,
  1175.                                         register __a2 APTR mem_pool,
  1176.                                         register __a1 struct ship *ship)
  1177. {
  1178.     struct shiptag *new;
  1179.     
  1180.     new=AllocVec(sizeof(struct shiptag),MEMF_ANY|MEMF_CLEAR);
  1181.     if (new) {
  1182.         strcpy(new->name,ship->name);
  1183.         new->id=ship->id;
  1184.         stci_d(new->attack,ship->attack);
  1185.         stci_d(new->defense,ship->defense);
  1186.         stci_d(new->speed,ship->speed);
  1187.         stci_d(new->cargo,ship->cargo);
  1188.         stci_d(new->fuel,ship->fuel);
  1189.         stci_d(new->cost,ship->cost);        
  1190.         stci_d(new->tech,ship->tech);
  1191.         return(new);}    
  1192.     return(0);
  1193. }
  1194.  
  1195. __saveds __asm struct tagchar *constag(register __a0 struct Hook *hook,
  1196.                                       register __a2 APTR mem_pool,
  1197.                                       register __a1 struct tagchar *tag)
  1198. {
  1199.     struct tagchar *new;
  1200.     
  1201.     new=AllocVec(sizeof(struct tagchar),MEMF_ANY|MEMF_CLEAR);
  1202.     if (new) {
  1203.         strcpy(new->name,tag->name);        
  1204.         strcpy(new->amount,tag->amount);       
  1205.         new->tagname = tag->tagname;
  1206.         new->tagdata = tag->tagdata;
  1207.         return(new);}    
  1208.     return(0);
  1209. }
  1210.  
  1211. SAVEDS ASM LONG desfleet(register __a0 struct Hook *hook, 
  1212.                          register __a2 APTR mem_pool,
  1213.                          register __a1 struct temp *fleet)
  1214. {
  1215.     FreeVec(fleet);
  1216.     return(0);
  1217. }
  1218.  
  1219. SAVEDS ASM LONG desship(register __a0 struct Hook *hook, 
  1220.                          register __a2 APTR mem_pool,
  1221.                          register __a1 struct shiptag *ship)
  1222. {
  1223.     FreeVec(ship);
  1224.     return(0);
  1225. }
  1226.  
  1227.  
  1228. SAVEDS ASM LONG destag  (register __a0 struct Hook *hook, 
  1229.                          register __a2 APTR mem_pool,
  1230.                          register __a1 struct tagchar *tag)
  1231. {
  1232.     FreeVec(tag);
  1233.     return(0);
  1234. }
  1235.  
  1236.  
  1237. SAVEDS ASM LONG dispfleet(register __a0 struct Hook *hook, 
  1238.                           register __a2 char **array,
  1239.                           register __a1 struct temp *fleet)
  1240. {
  1241.     if (fleet)
  1242.       {
  1243.       *array++ = fleet->x;
  1244.       *array++ = fleet->y;
  1245.       *array++ = fleet->planet;
  1246.       *array++ = fleet->empire;
  1247.       *array++ = fleet->attack;
  1248.       *array++ = fleet->defense;
  1249.       *array++ = fleet->speed;
  1250.       *array++ = fleet->cargo;
  1251.       *array++ = fleet->maxcargo;
  1252.       *array++ = fleet->range;
  1253.       *array++ = fleet->tox;
  1254.       *array++ = fleet->toy;
  1255.       *array   = fleet->destination;
  1256.       
  1257.       }
  1258.     else {
  1259.       *array++ = "X";
  1260.       *array++ = "Y";
  1261.       *array++ = "Planet";
  1262.       *array++ = "Empire";
  1263.       *array++ = "Attack";
  1264.       *array++ = "Deffense";
  1265.       *array++ = "Speed";
  1266.       *array++ = "Cargo";
  1267.       *array++ = "MaxCargo";
  1268.       *array++ = "Range";
  1269.       *array++ = "To X";
  1270.       *array++ = "To Y";
  1271.       *array   = "To Planet";
  1272.       
  1273.       }
  1274.     return(0);
  1275.   
  1276. }
  1277.  
  1278. SAVEDS ASM LONG dispship(register __a0 struct Hook *hook, 
  1279.                           register __a2 char **array,
  1280.                           register __a1 struct shiptag *ship)
  1281. {
  1282.     if (ship)
  1283.       {
  1284.       *array++ = ship->name;
  1285.       *array++ = ship->attack;
  1286.       *array++ = ship->defense;
  1287.       *array++ = ship->speed;
  1288.       *array++ = ship->cargo;
  1289.       *array++ = ship->fuel;
  1290.       *array   = ship->cost;
  1291.       }
  1292.     else {
  1293.       *array++ = "Type";
  1294.       *array++ = "Att";
  1295.       *array++ = "Def";
  1296.       *array++ = "Spd";
  1297.       *array++ = "Carg";
  1298.       *array++ = "Fuel";
  1299.       *array   = "Cost";
  1300.     }
  1301.     return(0);
  1302. }
  1303.  
  1304. SAVEDS ASM LONG disptag  (register __a0 struct Hook *hook, 
  1305.                           register __a2 char **array,
  1306.                           register __a1 struct tagchar *tag)
  1307. {
  1308.     if (tag)
  1309.       {
  1310.       *array++ = tag->amount;
  1311.       *array   = tag->name;
  1312.       }
  1313.     else {
  1314.       *array++ = "Number";
  1315.       *array   = "Item";
  1316.       }
  1317.     return(0);
  1318. }
  1319.  
  1320. SAVEDS ASM LONG disppurch  (register __a0 struct Hook *hook, 
  1321.                            register __a2 char **array,
  1322.                            register __a1 struct tagchar *tag)
  1323. {
  1324.     if (tag)
  1325.       {
  1326.       *array++ = tag->amount;
  1327.       *array   = tag->name;
  1328.       }
  1329.     else {
  1330.       *array++ = "Cost";
  1331.       *array   = "Item";
  1332.       }
  1333.     return(0);
  1334. }
  1335.  
  1336. __saveds __asm struct temp *consfleet(register __a0 struct Hook *hook,
  1337.                                       register __a2 APTR mem_pool,
  1338.                                       register __a1 struct force *fleet)
  1339. {
  1340.       
  1341.     struct temp *new;
  1342.     struct course *sector;
  1343.     int x2,y2;
  1344.     
  1345.     new=AllocVec(sizeof(struct temp),MEMF_ANY|MEMF_CLEAR);
  1346.     if (new) {
  1347.         stci_d(new->x,fleet->x);
  1348.         stci_d(new->y,fleet->y);
  1349.         if (SECTOR[fleet->x][fleet->y].PLANET) 
  1350.           strcpy(new->planet,SECTOR[fleet->x][fleet->y].PLANET->name);
  1351.         else strcpy(new->planet,"\n");
  1352.         if (fleet->id==0) strcpy(new->empire,"Independent");
  1353.         else strcpy(new->empire,fleet->empire);
  1354.         stci_d(new->attack,fleet->attack);
  1355.         stci_d(new->defense,fleet->defense);
  1356.         stci_d(new->speed,fleet->maxmove);
  1357.         stci_d(new->cargo,fleet->cargo);
  1358.         stci_d(new->maxcargo,fleet->maxcargo);
  1359.         stci_d(new->range,(fleet->fuel/fleet->fuelturn));      
  1360.         new->ship = fleet;
  1361.         sector = fleet->nextsector;
  1362.  
  1363.         if (fleet->planet1 != fleet->planet2) {
  1364.           if (fleet->planet1 == SECTOR[fleet->x][fleet->y].PLANET->ID) {   
  1365.             x2 = planetlist[0][fleet->planet2].x;
  1366.             y2 = planetlist[0][fleet->planet2].y;
  1367.             } 
  1368.           else {
  1369.             x2 = planetlist[0][fleet->planet1].x;
  1370.             y2 = planetlist[0][fleet->planet1].y;
  1371.             }
  1372.           
  1373.           stci_d(new->tox,planetlist[0][fleet->planet2].x);
  1374.           stci_d(new->toy,planetlist[0][fleet->planet2].y);
  1375.           strcpy(new->destination,SECTOR[x2][y2].PLANET->name);                    
  1376.         } 
  1377.         else {
  1378.           while (sector) {
  1379.             if (!sector->next) {
  1380.               stci_d(new->tox,sector->x);
  1381.               stci_d(new->toy,sector->y);
  1382.               if (SECTOR[sector->x][sector->y].PLANET) 
  1383.               strcpy(new->destination,SECTOR[sector->x][sector->y].PLANET->name);                
  1384.             }
  1385.           sector = sector->next;
  1386.           }
  1387.         }
  1388.  
  1389.         
  1390.         return(new);
  1391.       }    
  1392.     return(0);
  1393. }
  1394.  
  1395. LONG guiRequest(LONG id) {
  1396.   
  1397.   switch (id) {
  1398.      case 1:
  1399.        return(MUI_Request(app,WI_Mainwindow,0,"Quiting MUIEmpire...", "Quit|*Cancel", "Are you sure you want to Quit!"));
  1400.        break;
  1401.      case 2:
  1402.        MUI_Request(app,WI_Mainwindow,0,NULL, "OK", "Not enough fuel to load fleet!");
  1403.        break;
  1404.      case 3:
  1405.        MUI_Request(app,WI_Mainwindow,0,NULL, "OK", "You do not have enough cargo space for a full load of fuel!"); 
  1406.        break;
  1407.      case 4:
  1408.        MUI_Request(app,WI_Mainwindow,0,NULL, "OK", "You do not own the planet!");                 
  1409.        break; 
  1410.      case 5: 
  1411.        MUI_Request(app,WI_ShipDesign,0,NULL, "OK", "Not enough credits for ship design");
  1412.        break; 
  1413.      case 6:
  1414.        MUI_Request(app,WI_Mainwindow,0,NULL,  "OK",VSTRING);
  1415.        break;
  1416.      case 7:
  1417.        MUI_Request(app, WI_Mainwindow, 0, NULL, "OK", "ATTENTION!!!, The %s has conquered the galaxy! The Game is Over.", currentplayer->empire);
  1418.        break;
  1419.      case 8: 
  1420.        MUI_Request(app, WI_Mainwindow, 0, NULL, "OK", "ATTENTION!!!, The %s has conquered the puny human players! The Game is Over.", currentcomputerplayer->empire);
  1421.        break;
  1422.      case 9:
  1423.        if (currentplayer) MUI_Request(app, WI_Mainwindow, 0, NULL, "OK", "Attention %s! It is your turn.", currentplayer->name);
  1424.        break;
  1425.                
  1426.           
  1427.   }
  1428.   return(0);
  1429. }
  1430.  
  1431. /*************************/
  1432. /* Init & Fail Functions */
  1433. /*************************/
  1434.  
  1435. VOID fail(APTR app2,char *str)
  1436. {
  1437.   
  1438.   
  1439.         if (app2)
  1440.                 MUI_DisposeObject(app2);
  1441.  
  1442. #ifndef _DCC
  1443.         if (MUIMasterBase)
  1444.                 CloseLibrary(MUIMasterBase);
  1445.         if (UtilityBase)
  1446.                 CloseLibrary(UtilityBase);
  1447.  
  1448. #endif
  1449.  
  1450.         if (str)
  1451.         {
  1452.                 puts(str);
  1453.                 exit(20);
  1454.         }
  1455.         exit(0);
  1456. }
  1457.  
  1458. static ULONG MUIM_xxx_CallRedraw(struct IClass *TheClass, Object *TheObject, Msg Message)
  1459. {
  1460.   /* set up some info in your instancedata, if required */
  1461.   MUI_Redraw(MyObj,MADF_DRAWOBJECT);
  1462.   return 0;
  1463. }
  1464.  
  1465.  
  1466.